﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content3" ContentPlaceHolderID="JSContent" runat="server">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="/Scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/Scripts/jquery.validate.rules.js"></script>
    <script type="text/javascript">
        $(function () {
            $('.add-address').click(function () {
                $(this).siblings('.common-form').removeClass("hide");
                return false;
            })
        })

        $(document).ready(function () {
            $("#new_assress").validate();
        });
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%: Html.Partial("Sidebar") %>
    <div id="main">
        <div class="main-block">
            <h2 class="title">
                <%:"My Account".Localize() %></h2>
            <div class="main-block-content clearfix">
                <div class="tabs">
                    <a href="<%= this.ViewData["ProfileLinks"].Bind("Profile") %>">
                        <%:"Account Info".Localize() %></a> <a href="<%= this.ViewData["ProfileLinks"].Bind("Password") %>">
                            <%:"Change Password".Localize() %></a> <a class="current" href="<%= this.ViewData["ProfileLinks"].Bind("Address") %>">
                                <%:"Address Lists".Localize() %></a> <a href="<%= this.ViewData["ProfileLinks"].Bind("Order") %>">
                                    <%:"My Orders".Localize() %></a> <a href="<%= this.ViewData["ProfileLinks"].Bind("SupportTicket") %>">
                                        <%:"Support Ticket".Localize() %></a>
                </div>
                <div class="tab-content">
                    <div class="tab-block">
                        <table>
                            <tbody>
                                <%
                                    foreach (object item in ViewBag.Addresses)
                                    {
                                %>
                                <tr>
                                    <td>
                                        <%: item.Bind("FirstName") %>
                                        <%: item.Bind("LastName") %>
                                    </td>
                                    <td>
                                        <%: item.Bind("Address1") %>
                                        <%:item.Bind("Address2") %>
                                        <%: item.Bind("City") %>
                                        <%: item.Bind("State") %>
                                        <%:  ((IAddress)item).Country.CountryName %>
                                    </td>
                                    <td>
                                        <%: item.Bind("Postcode") %>
                                    </td>
                                    <td>
                                        <%: item.Bind("Phone") %>
                                    </td>
                                    <td>
                                        <%: Html.ActionLink("Edit", "AddressEdit", new {id=item.Bind("Id")}) %>
                                    </td>
                                    <td>
                                        <%: Html.ActionLink("Delete", "Delete", new { id = item.Bind("Id") }, new { onclick = "return confirm('Are you sure to delete this address?');" })%>
                                    </td>
                                </tr>
                                <%
                                    }
                                %>
                            </tbody>
                        </table>
                    </div>
                    <div class="tab-block">
                        <a class="button add-address" href="#"><span>
                            <%:"Add a new address".Localize() %></span></a>
                        <div class="common-form hide">
                            <form id="new_assress" action="<%= this.ViewData["FormAction"] %>" method="post">
                            <%: Html.Partial("AddressItem", null, ViewData) %>
                            <fieldset class="buttons">
                                <button class="button" type="submit">
                                    <em><span>
                                        <%:"Add".Localize() %></span></em></button>
                            </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Breadcrumb" runat="server">
    <ul class="breadcrumb">
        <li><a href="/">
            <%:"Home".Localize() %></a>&gt;</li>
        <li><a href="/My">
            <%:"Account".Localize() %></a>&gt;</li>
        <li>
            <%:"Address".Localize() %></li>
    </ul>
</asp:Content>
